{
  "properties" : { },
  "id" : "49fe52405fc94ee7b478d121f582d9b2",
  "script" : null,
  "groupId" : "168ab8e1df704072b606deba835794ac",
  "name" : "对话",
  "createTime" : null,
  "updateTime" : 1741367987191,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "chat",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\n    \"content\": \"不知道真假\",\n    \"sence_id\": 3,\n    \"sence_pid\": 1,\n    \"sence_name\": \"霸道总裁\",\n    \"sence_p_name\": \"热恋\",\n    \"type\": 1\n}",
  "headers" : [ {
    "name" : "token",
    "value" : "e1ddacb6-1095-492b-89b7-317bb3abea79",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 200,\n    \"message\": \"success\",\n    \"data\": \"在我面前，无需辨别真假，因为我所说的一切，都是为了让你感受到我的真心。\",\n    \"timestamp\": 1741194628911,\n    \"executeTime\": 1177\n}",
  "description" : null,
  "requestBodyDefinition" : {
    "name" : "root",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "content",
      "value" : "不知道真假",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "sence_id",
      "value" : "3",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "sence_pid",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "sence_name",
      "value" : "霸道总裁",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "sence_p_name",
      "value" : "热恋",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "type",
      "value" : "1",
      "description" : "1-帮我恢复",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "200",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "“霸道总裁”这一概念通常源于小说、电视剧和电影等娱乐作品，它们描绘了一种特定类型的男性角色——拥有权力、财富和强势性格的商业巨头。这些角色在虚构作品中非常受欢迎，但它们与现实生活中的人物有着本质的区别。以下是关于“霸道总裁”的一些详细信息：\n\n### 霸道总裁的定义和特点\n\n- **小说和影视作品中的霸道总裁**：通常拥有完美的身材、英俊的外表、无尽的财富和强势的性格。他们往往在商业世界中占据主导地位，对周围的人有着绝对的掌控力。在文学和影视作品中，霸道总裁的形象往往被夸张和理想化，以满足观众的幻想。\n- **现实中的类似角色**：虽然现实生活中可能不存在完全符合小说描述的霸道总裁，但一些成功的企业家和管理者可能具有类似的特点，如强烈的领导力和决策力。然而，这些人在生活中往往更加低调和务实，不会像小说角色那样高调。\n\n### 霸道总裁题材的小说和影视作品\n\n- **小说推荐**：例如《霸道总裁,御夫有道》、《一纸契约,霸道总裁太危险》等，这些小说通常讲述了权势滔天的商业霸主与各种不同身份的女主之间的爱情故事。\n- **影视作品**：经典如《王子变青蛙》、《何以琛》等，这些作品中的霸道总裁形象深入人心，成为了许多人心中难以超越的经典。\n\n虽然“霸道总裁”作为一种文化符号在小说和影视作品中广受欢迎，但我们应该意识到这些角色是虚构的，他们并不完全代表现实生活中的任何一类人。在欣赏这些作品时，我们可以从中获得娱乐和灵感，但同时也应该保持理性和批判性思维，不要将虚构的角色和现实混淆。",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1741194528212",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "10792",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import cn.dev33.satoken.stp.StpUtil
import log
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import java.time.LocalDateTime;
import '@/ai/coze' as coze
// import '@/ai/doChat' as doChat
import '@/ai/doChatHuanYuan' as doChatHuanYuan
//检查用户
// var userId = 1
var userId = StpUtil.getLoginId()
//检测指纹 只有登录的时候检测，这里就不检测了
let nowStr = now()
var res = {}
//检测订阅的是什么套餐
var subscriptionList = db.table("subscription").where().eq("user_id", userId).orderByDesc("end_time").select()
log.info("subscriptionList-->"+subscriptionList::stringify)

if (subscriptionList!=null && subscriptionList.size() == 1 && subscriptionList[0].packageId == 1) { //如果是订阅免费套餐套餐
    //查询余额表，看看还剩多少次数
    var credit = db.table("credit").where().eq("user_id", userId).selectOne()
    if (credit != null) {
        int remainCount = credit.remainCount
        if (remainCount = 0) {
            exit 400, "免费次数已用完，继续使用请订阅套餐";
        } else {
            // 执行对话
            res = doChatHuanYuan(body, userId)
        }
    }
} else if (subscriptionList.size() > 1) {
    //2099然后应该就是到最后的订阅时间了
    var subscri = subscriptionList[1]
    let nowTime = LocalDateTimeUtil.of(DateUtil.parse(nowStr::string));
    var endTime = subscri.endTime
    if (endTime.isAfter(nowTime)) {
        log.info("endTime 在 now 之后")
    } else if (endTime.isBefore(nowTime)) {
        log.info("endTime 在 now 之前")
        exit 400, "您的会员已过期，请重新订阅";
    } else {
        log.info("endTime 和 now 相等")
    }
    res = doChatHuanYuan(body, userId)
} else {
    exit 400, "您未订阅或者订阅已过期";
}
return res